package com.db.concurrency.factorizer.cached;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author Alexander Kotov (kotov.alex.22@gmail.com)
 */
public class FactorizeTasks {
    private final List<Integer> tasks = new ArrayList<Integer>();

    public FactorizeTasks(int begin, int end, int entryCount) {

        if (begin < 1 || end < 1 || entryCount <= 0 || begin > end) {
            throw new IllegalArgumentException("Illegal arguments");
        }

        for (int i = begin; i <= end; ++i) {
            for (int j = 0; j < entryCount; ++j){
                tasks.add(i);
            }
        }
    }

    public Collection<Integer> getTasks() {
        return tasks;
    }
}
